package com.blb.demo2;

public class BaoziDemo {

    public static void main(String[] args) {

        BaoZiPu baoZiPu = new BaoZiPu();


        Thread thread = new Thread(() -> {
            for (int i = 0; i < 200; i++) {
                baoZiPu.makeBaozi();
            }
        });
        thread.setName("包子铺老张");
        thread.start();

        for (int i = 0; i < 10; i++) {
            Thread thread1 = new Thread(() -> {
                for (int j = 0; j < 20; j++) {
                    baoZiPu.sellBaozi();
                }
            });

            thread1.setName("消费者"+i);
            thread1.start();
        }
        


    }




}
